@layout("/common/_curd/_container.html"){

<script type="text/javascript">
	var ctx = "${basePath}";
	var grid_selector = "#grid-table";
	var pager_selector = "#grid-pager";
	
	$(function(){
		initGrid();
		initMenuBtn("btns", "${code}");
	});
	
	function initGrid(){
		var grid_url = ctx + "/${code}/list";
		var _colnames = ["ID",
						"权限名称",
						"权限范围",
						"是否默认"];
		var _colmodel = [{name:"id", index:"id", width:100,hidden:true},
						{name:"name", index:"name", width:50},
						{name:"auth", index:"auth", width:100},
						{name:"is_default", index:"is_default", width:30,formatter:fmatterDefault}
        ];
		
		jQuery(grid_selector).jqGrid({
			url : grid_url,
		    shrinkToFit : true,
			colNames : _colnames,
			colModel : _colmodel, 
			jsonReader : {id :"id"},
			pager : pager_selector,
			postData : {sort : "id", order : "desc"}
		});
	}

    function fmatterDefault(cellvalue, options, rowObject){
        if (cellvalue==1){
            return '<span class="label label-sm label-success">是</span>';
        }else{
            return '<span class="label label-sm label-warning">否</span>';
        }
    }
</script>


	<!-- 配置 grid -->
	<div class="row">
		<div class="col-xs-12 tb-grid">
			<!-- 配置 查询 -->
			@ var _col=[
			@		{name:"通知名称", index:"name", type:"text"},
			@		{name:"老师权限-1查全部", index:"teacher_auth", type:"text"},
			@		{name:"学生权限", index:"student_auth", type:"text"},
			@		{name:"家长权限", index:"parent_auth", type:"text"}
			@];
			<!-- include("/common/_function/_search.html",{"col":_col}){}-->
			<!-- 按钮 -->
			<div class="welljq well-sm" id="btns"></div>
			<!-- grid -->
			<table id="grid-table"></table>
			<!-- 分页-->
			<div id="grid-pager"></div>
		</div>
	</div>
	
	<!-- 引入所需的js -->
	@include("/common/_listscript.html"){}
	
@}	